<?xml version="1.0" encoding="UTF-8"?>
<definitions id="definitions" 
  xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
  xmlns:camunda="http://camunda.org/schema/1.0/bpmn"
  targetNamespace="Examples">
  
  <message id="messageId" name="Message" />
  <process id="receiveTaskCompensationHandler" isExecutable="true">

    <startEvent id="start" />
    
    <sequenceFlow sourceRef="start"  targetRef="activity" />
    <userTask id="activity" />
    <sequenceFlow sourceRef="activity" targetRef="throwCompensate" />
    
    <intermediateThrowEvent id="throwCompensate">
      <compensateEventDefinition activityRef="activity" />
    </intermediateThrowEvent>
    
    <sequenceFlow sourceRef="throwCompensate" targetRef="beforeEnd" />
    <userTask id="beforeEnd" />
    <sequenceFlow sourceRef="beforeEnd" targetRef="end" />
    <endEvent id="end" />

    <!-- receive task compensation handler for "activity" -->
    <boundaryEvent id="compensateBoundaryEvent" attachedToRef="activity">
      <compensateEventDefinition />
    </boundaryEvent>  
    <receiveTask id="compensationHandler" messageRef="messageId" isForCompensation="true"/>
    <association associationDirection="One" sourceRef="compensateBoundaryEvent" targetRef="compensationHandler" />
  </process>

</definitions>
